package ru.dadle8.service.impl.callback;

import org.telegram.telegrambots.meta.api.methods.send.SendMediaGroup;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import ru.dadle8.model.bot.entity.ContentMessage;
import ru.dadle8.service.api.callback.CallbackService;
import ru.dadle8.service.impl.AbstractMessageService;

import java.util.List;

public abstract class AbstractCallbackService extends AbstractMessageService implements CallbackService {

    protected void sendMedia(ContentMessage contentMessage, Long chatId) throws TelegramApiException {
        if (contentMessage.getVideos().size() == 1) {
            Message messages = getBot().execute(getMessageHelper().sendVideo(chatId, contentMessage));
        } else {
            List<SendMediaGroup> sendMediaGroups = getMessageHelper().sendMediaGroups(chatId, contentMessage);
            for (SendMediaGroup sendMediaGroup : sendMediaGroups) {
                List<Message> messages = getBot().execute(sendMediaGroup);
            }
        }
    }
}
